#include <iostream>
#include <typeinfo>

class Person {
 public:
  virtual ~Person() {}
};

class Employee : public Person {
  
};

int main()
{
  Person   person;
  Employee employee;
  Person*  ptr = &employee;
  Person&  ref = employee;

  std::cout << typeid(person).name() << std::endl;    // Person
  std::cout << typeid(employee).name() << std::endl;  // Employee
  std::cout << typeid(ptr).name() << std::endl;       // Person*
  std::cout << typeid(*ptr).name() << std::endl;      // Employee

  std::cout << typeid(ref).name() << std::endl;       // Employee

  Person* p = nullptr;

  try {
    typeid(*p);
  }
  catch(...) {
    
  }

  Person& pRef = *p;
  typeid(pRef);
}
